package iu.test;

import org.testng.annotations.*;
import pages.HomePage;
import selenium.WebDriverFactory;
import selenium.WebDriverWrapper;
import utils.LogTest;
import utils.PropertyLoader;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * Created by Olga on 22.05.2014.
 */
public class OpenClose {
    public static WebDriverWrapper driver;

    @BeforeSuite
    public void initEnv() {


        driver = WebDriverFactory.setBrowser(PropertyLoader.loadProperty("browser.name"));
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
        HomePage page = new HomePage(driver);
        page.openHomePage();

        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        LogTest.info(" Coockies deleted");

    }


    @AfterSuite
    public void shutEnv() {
        if (driver != null) {
            driver.quit();
        }
    }

    @BeforeMethod
    public void clearCoockies() {
        driver.manage().deleteAllCookies();
    }

}
